LZ77 is a lossless data compression algorithm. One algorithm that uses LZ77 is DEFLATE. DEFLATE is widely used and forms the basis for formats such as gzip/zlib and Winzip/PKZIP. LZ77 compression looks for the longest string from a history buffer, also called a sliding window, which matches the current location's string in the input buffer. A hash function is performed on an (n)-byte prefix of the current string to generate a hash table index and lookup a data structure that returns a list of locations/pointers into the history buffer where possible matches may be found. The compression process typically searches a large number of locations and determines the longest/best match, and then encodes the length/distance of the best match. The effort (e.g., number of searches attempted) is controlled by a compression level. Gzip/zlib define a number of levels of compression, ranging from 1 to 9, with 9 being the best compression ratio, but at the cost of the greatest amount of processing (e.g., up-to 4K searches per byte position).